package com.github.catvod.parser;

import com.github.catvod.crawler.SpiderDebug;
import com.github.catvod.spider.merge.CE;
import com.github.catvod.spider.merge.fP;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorCompletionService;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import org.json.JSONObject;

public class JsonParallel {
  public static JSONObject parse(LinkedHashMap<String, String> paramLinkedHashMap, String paramString) {
    try {
      if (paramLinkedHashMap.size() > 0) {
        JSONObject jSONObject;
        ExecutorService executorService = Executors.newFixedThreadPool(3);
        ExecutorCompletionService<JSONObject> executorCompletionService = new ExecutorCompletionService();
        this(executorService);
        ArrayList<Future> arrayList = new ArrayList();
        this();
        for (String str1 : paramLinkedHashMap.keySet()) {
          String str2 = paramLinkedHashMap.get(str1);
          Callable<JSONObject> callable = new Callable<JSONObject>() {
              final String V0;
              
              final String h;
              
              final String j;
              
              public JSONObject call() {
                try {
                  HashMap<String, String> hashMap = JsonBasic.getReqHeader(this.h);
                  String str2 = hashMap.get("url");
                  hashMap.remove("url");
                  StringBuilder stringBuilder = new StringBuilder();
                  this();
                  stringBuilder.append(str2);
                  stringBuilder.append(this.V0);
                  SpiderDebug.log(stringBuilder.toString());
                  stringBuilder = new StringBuilder();
                  this();
                  stringBuilder.append(str2);
                  stringBuilder.append(this.V0);
                  String str1 = fP.Qy(stringBuilder.toString(), "p_json_parse", hashMap);
                  JSONObject jSONObject = CE.BQ(this.V0, str1);
                  return jSONObject;
                } finally {
                  Exception exception = null;
                  SpiderDebug.log(exception);
                } 
              }
            };
          super(str2, paramString, str1);
          arrayList.add(executorCompletionService.submit(callable));
        } 
        paramLinkedHashMap = null;
        for (byte b = 0;; b++) {
          LinkedHashMap<String, String> linkedHashMap = paramLinkedHashMap;
          if (b < arrayList.size()) {
            Exception exception;
            Future<JSONObject> future = executorCompletionService.take();
            try {
              jSONObject = future.get();
              jSONObject1 = jSONObject;
            } finally {
              exception = null;
            } 
            SpiderDebug.log(exception);
            JSONObject jSONObject1 = jSONObject;
            continue;
          } 
          break;
        } 
        try {
          executorService.shutdownNow();
        } finally {
          paramLinkedHashMap = null;
        } 
      } 
    } finally {
      paramLinkedHashMap = null;
    } 
  }
}


/* Location:              /Users/hetaiyi/Desktop/my/tech/java/study/aa/temp/temp.jar!/com/github/catvod/parser/JsonParallel.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       1.1.3
 */